<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<HTML>
<HEAD>
	<TITLE> ZTREE DEMO - noLine </TITLE>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" href="../admin/css/zTreeStyle/zTreeStyle.css" type="text/css">
	<script type="text/javascript" src="../admin/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="../admin/js/jquery.ztree.core-3.4.js"></script>
	 <script type="text/javascript" src="../admin/js/jquery.ztree.excheck-3.4.js"></script>
	 <!--  <script type="text/javascript" src="../../../js/jquery.ztree.exedit-3.4.js"></script>-->
	<SCRIPT type="text/javascript">
		<!--
		var setting = {
				check: {
					enable: true
				},
				view: {
					showLine: false
				},
				data: {
					simpleData: {
						enable: true
					}
				}
				
		};
		
		function setCheck() {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
			py = $("#py").attr("checked")? "p":"",
			sy = $("#sy").attr("checked")? "s":"",
			pn = $("#pn").attr("checked")? "p":"",
			sn = $("#sn").attr("checked")? "s":"",
			type = { "Y":py + sy, "N":pn + sn};
			zTree.setting.check.chkboxType = type;
			//showCode('setting.check.chkboxType = { "Y" : "' + type.Y + '", "N" : "' + type.N + '" };');
		}
		function showCode(str) {
			if (!code) code = $("#code");
			code.empty();
			code.append("<li>"+str+"</li>");
		}
		
		$(document).ready(function(){
			$.ajax({
				type:'post',//可选get
				url:'../../ajax/menu!tree.do',//这里是接收数据
				dataType:'json',
				success:function(data){
					$.fn.zTree.init($("#treeDemo"), setting, data);
					setCheck();
					$("#py").bind("change", setCheck);
					$("#sy").bind("change", setCheck);
					$("#pn").bind("change", setCheck);
					$("#sn").bind("change", setCheck);
				},
				error:function (XMLHttpRequest, textStatus, errorThrown) {     
						alert(errorThrown);     
						}     	
			});
			

		});
		//-->
	</SCRIPT>

</HEAD>

<BODY>

	<div >
		<ul id="treeDemo" class="ztree"></ul>
	</div>
</div>
</BODY>
</HTML>